import api from '@/api/index'
import { systemServer } from '@/utils/apiConfig'
// 分页查询信息
export const getDicList = <T>(data?: unknown) => {
  return api.get<T>(systemServer + '/dictionary', data)
}
// 一级字典新增
export const addParentSubmit = <T>(data?: unknown) => {
  return api.post<T>(systemServer + '/dictionary', data)
}
// 一级字典修改
export const editParentSubmit = <T>(id: string, data?: unknown) => {
  return api.put<T>(systemServer + '/dictionary/' + id, data)
}
// 字典项值新增
export const addSubmit = <T>(id: string, data?: unknown) => {
  return api.post<T>(systemServer + '/dictionary/' + id + '/itemValue', data)
}
// 字典项值修改
export const editSubmit = <T>(id: string, data?: unknown) => {
  return api.put<T>(systemServer + '/dictionary/itemValue/' + id, data)
}
// 字典项值删除
export const delSubmit = <T>(id: string) => {
  return api.delete<T>(systemServer + '/dictionary/itemValue/' + id)
}
// 字典名称判重
export const dicNameExist = <T>(data?: unknown) => {
  return api.get<T>(systemServer + '/dictionary/checkDictionaryNameExisted', data)
}
// 字典编码判重
export const dicCodeExist = <T>(data?: unknown) => {
  return api.get<T>(systemServer + '/dictionary/checkDictionaryCodeExisted', data)
}
